home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / HAM / AUTOPAC.TXT < prev    next >
Text File  |  1987-07-11  |  7KB  |  135 lines

  1.                       AUTO-ANSWER FOR PACKET AND PC
  2.                          by Joel Ackerman, KE4SW
  3.  
  4.     (for PC users with Procomm Version 2.4 or higher, and TNC-2 type TNCs)
  5.  
  6. Have you ever waited and waited for your buddy to connect to you so you could
  7. send (or receive) a particular (always important) message, just to have him 
  8. connect and disconnect while you went to the refrigerator for a new 807?  If 
  9. you are a PC user you may be interested in the programs below, which take 
  10. advantage of the powerful script programming language which is part of the 
  11. communications package ProComm (available on most bulletin boards and priced 
  12. very reasonably from DataStorm).  I developed the programs below 
  13. because I had no BBS that my dad and I could both check into for message 
  14. passing, plus we wanted an easy way to pass traffic too routine for the 
  15. BBS's (you know, "Just wanted to say 'Hi' type of traffic") while I 
  16. automatically could receive what-ever traffic he had for me.
  17.  
  18. You may choose to use only the script file (PACKET.CMD) starting it when you
  19. wish to let the computer monitor the tnc, or you can implement the associated
  20. batch files so the computer takes over the tnc from power-up, until you stop
  21. the script (by hitting Escape)...This approach allows the system to restart 
  22. after a power failure.
  23.  
  24. The system below performs the following functions:
  25.  
  26.      1.  It sets the (basically inaccurate) clock in my TNC to the (more 
  27.          accurate) time from my computer.
  28.      2.  It starts the communications program, initializing the TNC's monitor
  29.          parameters (so I can read the mail when I'm around.
  30.      3.  It then waits for a CONNECT, at which time it sets off an alarm for
  31.          me to "answer the radio" if I'm around
  32.      4.  If I'm not around, it checks to see if I have left the name of the 
  33.          caller, and if so, if I have left a message for him.
  34.      5.  It sends him whatever message I've left (any length).
  35.      6.  Whether or not he had a message, it opens a file and receives the
  36.          caller's message.
  37.      7.  It then thanks the caller, closes the log file, and disconnects so
  38.          it will be ready for the next caller.
  39.  
  40. A computerized answering machine!  Would you like to know how all this stuff
  41. works?  Then read on....
  42.  
  43.  
  44. The autoexec.bat file below contains the commands to set the clock in the tnc
  45. and then start Procomm and execute the programs to have Procomm answer the TNC
  46. when connected.  You will probably change most of the commands to match your
  47. system, so this file is for reference only.
  48.  
  49.  
  50. AUTOEXEC.BAT
  51. ------------
  52.  
  53. path c:\;c:\bat;c:\util;c:\dos          ;JUST SETS MY PATH
  54. set procomm=c:\coms\procomm             ;FOR PROCOMM TO FIND IT'S FILES
  55. prompt $p$g                                ;PROMPT WHEN IN DOS
  56. rtclock                                    ;SETS REALTIME CLOCK
  57. cd\coms\procomm                            ;CHANGE TO PROCOMM'S DIR
  58. basic da                                ;RUN BASIC PROGRAM DA.BAS (BELOW)
  59. copy pac.+da.+packet.cmd pacda.cmd      ;COPY THREE FILES INTO COMMAND FILE
  60. procomm /fpacda                         ;START PROCOMM AND EXECUTE PACDA.CMD
  61. cd\                                     ;DONE W/PROCOMM...
  62.  
  63.  
  64.  
  65. Here is the basic program DA.BAS executed by autoexec.bat after the realtime
  66. clock sets itself:
  67.  
  68. 10 D$=DATE$ ' Get the Date
  69. 20 T$=TIME$ ' And the time
  70. 30 MM$=MID$(D$,1,2):DD$=MID$(D$,4,2):YY$=MID$(D$,9,2) ' parse Date
  71. 40 HH$=MID$(T$,1,2):MI$=MID$(T$,4,2) ' parse hour and min from Time
  72. 50 DA$="DA "+YY$+MM$+DD$+HH$+MI$+"! !" ' Create DA code string
  73. 55 PRINT "TNC time will be set to ";DA$ 'Message on the screen
  74. 60 OPEN "O",1,"DA."                     ' Create File DA.
  75. 70 WRITE #1,DA$                            ' Write DA code into file
  76. 80 CLOSE                                ' Close file
  77. 90 SYSTEM                               ' And back to autoexec file
  78.  
  79. This program will create a file called DA. which will contain only the 
  80. command to set the time, e.g.:
  81.            "DA 8611151646"
  82.  
  83. Even if you're not a Procomm user, you probably can take advantage of the 
  84. above idea.  All you have to do is send the file created above to your TNC.
  85.  
  86. The file below (called PAC) has the results of the program above tacked onto 
  87. the end of it. It is executed, followed by PACKET.CMD.
  88.  
  89. TRANSMIT "~+++~~~ATS0=0!"           ;Tell Hayes Modem not to answer phone.
  90. PAUSE 1                             ;Wait a second for result
  91. SET PORT COM1                       ;Change port to Com1
  92. SET BAUDRATE 1200                   ;       1200 BPS    \
  93. SET PARITY EVEN                        ;       Even Parity  |-set for your TNC
  94. SET DATABITS 7                      ;       7 bits      /
  95. LOG OPEN                            ;Open default log file
  96. TRANSMIT "MONITOR OFF!"             ;Turn Monitor off
  97. TRANSMIT                            ; No CR after word...DA command goes here
  98.  
  99. End this file with a space after the word TRANSMIT (no CR) and the copy
  100. command will append the command from DA on the same line.  This is really 
  101. a quick and very dirty solution.  If you're a better BASIC programmer than I
  102. am, please fix this and let me know how you did it. (I'll even give you the 
  103. credit!)  But this method does work, so who cares!!
  104.  
  105. PACKET.CMD is maintained as a separate file because you may choose to start
  106. the program after you've been in Procomm in a communicating session.  It works
  107. either way, whether it's tacked on to the end of PACDA.CMD, or if you start it
  108. yourself.  The only difference is that the clock won't be set for you.  By the
  109. way, all the Monitor On, Monitor Off commands can be eliminated if you like. 
  110. They make things run more smoothly if the channel is real busy.  If you leave
  111. your monitor off anyway, just remove all of them and let it fly...One caution:
  112. leave MCON off when the script is running or all kinds of odd things might
  113. happen.
  114.  
  115. After date is set, packet.cmd waits for the CONNECT... You can start PACKET.CMD 
  116. anytime you are already in Procomm...then just walk away from the 
  117. computer/rig...
  118.  
  119.  
  120. Only one real bug has surfaced in all of the experiments we have run.  If you
  121. leave your modem on when your script starts, then the phone rings, Procomm
  122. doesn't know what happened on the other Com port and goes to gaga-land.  Not
  123. dangerous in itself, but it means re-booting the machine.  I left the
  124. code in because I'm (naively(?)) convinced that DataStorm will correct this
  125. little hitch now that I've brought it to their attention.
  126.  
  127. Thanks to Owen Adair, WD4FSU, for his help and comments in developing and 
  128. testing (and testing) the initial scripts, and to my father (DOC), KF4CX, for
  129. his patience and feedback.
  130.  
  131. I hope you enjoy using these scripts...I am sure I'll add bells and whistles
  132. from time to time...just connect to me and ask (me or the computer) for the
  133. latest mod... 73,                
  134.               Joel, KE4SW
  135.